<?php
$this->menu=array(
	array('label'=>'Create company', 'url'=>array('create'),'linkOptions'=>array('id'=>'create_company')),
	array('label'=>'Merge company', 'url'=>array('merging')),
	array('label'=>'Manage company', 'url'=>array('admin')),
);
?>

<h2>Company</h2>
<div class="row">
	<?php echo CHtml::activeLabelEx($model,'searchText'); ?>
	<?php echo CHtml::activeTextField($model,'searchText'); ?>
</div>
<?php $this->widget('zii.widgets.CListView', array(
	'dataProvider'=>$model->search(),
	'itemView'=>'_view',
)); ?>
<?php
$cs = Yii::app()->getClientScript();
$script =<<<EOD
$('#create_company').click(function(){
	var dialogButton = {
		Create:function(){
			$(this).find('form').find('[type=submit]').click();
		}
	};
	$.simplelogdialog({url:$(this).attr('href')},{width:400},dialogButton);
	return false;
});
$('input#company_searchText').keypress(function(event){
	if(event.keyCode == '13'){
		$.fn.yiiListView.update('yw0',{data:{searchText:$(this).val()}});
	}
});
EOD;
$cs->registerScript('company#list',$script);
?>